using System;
using System.Collections.Generic;
using System.Text;

namespace stsdev {
  class Program {

    [STAThread]
    static void Main(string[] args) {

      Console.WriteLine();
      Console.WriteLine("STSDEV - Simple Tools for SharePoint Developers");

      // run wizard if when no arguments are passed
      if (args.Length == 0) {
        SolutionBuilder.RunCreateSolutionWizard();
        return;
      }

      // look to first argument to determine operation
      // refresh is the only command supported in version 1.1
      string operation = args[0];
      switch (operation) {
        case "/refresh":
          if (args.Length < 3) {
            Console.WriteLine("ERROR - /refresh command requires SolutionName and SolutionDirectory as 2nd amd 3rd arguments");
          }
          else {
            Console.WriteLine("Refreshing Solution Package Files");
            // Modified 3/25/08 by RHoward - Trimmed surrounding quotes to support arguments with spaces
            string SolutionName = args[1].Trim('"');
            string SolutionDirectory = args[2].Trim('"');
            // End of 3/25/08 Modification
            SolutionBuilder.RefreshDeploymentFiles(SolutionName, SolutionDirectory);
          }
          break;
        default:
          Console.WriteLine("ERROR - Unknown command");
          break;
      }
    }
  }
}
